<?php
namespace app\index\controller;
class Xwzx extends Common
{
    //详情页
    public function article()
    {
    	$artid = input('artid');
        db('article')->where(array('id'=>$artid))->setInc('click');
        $article = db('article')->order('id asc')->find($artid);

        //列表是按照根据id降序排列的，所以上一篇
        $prv = db('article')->where('id','>',$artid)->order('id asc')->limit('1')->find();
        //列表是按照根据id降序排列的，所以下一篇
        $next = db('article')->where('id','<',$artid)->order('id desc')->limit('1')->find();
        $this->assign('next',$next);

        $this->assign(array(
            'article' => $article,
            'prv'     => $prv,
            'next'    => $next
        ));
        $this->view->engine->layout('xwzxlayout');
        return view();
    }
    
}
